//
// Created by 123 on 2024/12/27.
//

#include "stdio.h"


int main082(void){
    FILE* fp;
    char buffer[100];

    fp = fopen("rewind2.txt","r");
    if(fp == NULL){
        perror("open error");
        return 1;
    }
    if(fgets(buffer,sizeof(buffer),fp) == NULL){
        if(feof(fp)){
            printf("file is empty or to file last pos\n");
        }else if(ferror(fp)){
            perror("read file error\n");
        }
        fclose(fp);
    }
    printf("read content:%s\n",buffer);
    //关闭文件
    if(fclose(fp)!=0){
        perror("close file error!");
        return 1;
    }

    return 0;
}